home *** CD-ROM | disk | FTP | other *** search
/ Young & Modern Digital Makeover Magic / Young & Modern Digital Makeover Magic.iso / data1.cab / TempMKV / UtilRouting.js < prev    next >
Encoding:
JavaScript  |  1999-10-18  |  7.3 KB  |  310 lines

  1. ////////////////////////////////////////////////////////////////
  2. //
  3. //    UtilRouting.js
  4. //
  5. //     Routing routine mapping for generic pages
  6. //
  7. // Copyright (c) 1999 MGI Software Corp. All Rights Reserved
  8. // <Script>
  9.  
  10. function toggleDebug()
  11. {
  12.     top.debugLevel = top.debugLevel ? 0 : 1;
  13. alert("Debug Level: "+top.debugLevel);
  14. }
  15.  
  16. function debugalert(stralert)
  17. {
  18.     if (top.debugLevel)
  19.         alert(stralert);
  20. }
  21.  
  22. function MenuExec(evalCode)
  23. {
  24.     return top._RouteCall( "Liquid", evalCode );
  25. }
  26.  
  27. function BrowserExec(evalCode)
  28. {
  29.     return top._RouteCall( "Browser", evalCode );
  30. }
  31.  
  32. function ActivatePhotoModule(ID)
  33. {
  34. //   top.Browser.SetupBrowserView ('makeover') ;
  35.     top._RouteCall( "Browser", "_ActivatePhotoModule('"+ID+"');" );
  36. }
  37.  
  38. function ActivatePrintModule(ID)
  39. {
  40.     top._RouteCall( "Browser", "_ActivatePrintModule('"+ID+"');" );
  41. }
  42.  
  43. function ActivateLayoutModule(ID)
  44. {
  45.     top._RouteCall( "Browser", "_ActivateLayoutModule('"+ID+"');" );
  46. }
  47.  
  48. function ClickActivityButton(BtnID)
  49. {
  50.     // Just Click it, don't Do Anything
  51.     top._RouteCall( "ActivityList", "_ClickActivityButton('"+BtnID+"');" );
  52.     //_ALUpdateButton(BtnID);
  53. }
  54.  
  55. function SetCommandBar(str)
  56. {
  57.     LTKTriggerEvent(str);
  58. }
  59.  
  60. // Delete a routing (This will cascade up to StartPage.html)
  61. function DeleteRouting( Dest, FrameObject )
  62. {
  63.     return top._DeleteRouting( Dest, FrameObject );
  64. }
  65.  
  66. // Add a routing (This will cascade up to StartPage.html)
  67. function AddRouting( Dest, FrameObject, Dependants )
  68. {
  69.     return top._AddRouting( Dest, FrameObject, Dependants );
  70. }
  71.  
  72. // Route a function call (This will cascade up to StartPage.html)
  73. function RouteCall( Dest, EvalCode )
  74. {
  75.     return top._RouteCall( Dest, EvalCode );
  76. }
  77.  
  78. // Set Queueing mode (This will cascade up to StartPage.html)
  79. function SetQueueMode( Dest, Mode, Recurse )
  80. {
  81.     return top._SetQueueMode( Dest, Mode, Recurse );
  82. }
  83.  
  84. // Execute some code (called from StartPage.html)
  85. function EvalCode(MyCode)
  86. {
  87.     if( MyCode != "" )
  88.     {
  89.         return eval(MyCode);
  90.     }
  91. }
  92.  
  93. ////////////////////////////////////////////////////////////////
  94. //
  95. //    Simplified mappings
  96. //
  97.  
  98. // Roots
  99.  
  100. function GetLanguageFolder()
  101. {
  102.     // This is a hack for speed!
  103.     return top._GetLanguageFolder();
  104.     // Proper call should be:
  105.     // return top._RouteCall( "Root", "_GetLanguageFolder();" );
  106. }
  107.  
  108. function SetConsoleMode( Expert )
  109. {
  110.     // This is a hack for speed!
  111.     return top._SetConsoleMode( Expert );
  112.     // Proper call should be:
  113.     // return top._RouteCall( "Root", "_SetConsoleMode("+Expert+");" );
  114. }
  115.  
  116. // Liquid Toolkit (through proxies)
  117.  
  118. function LTKTriggerEvent(driver)
  119. {
  120.     return top._RouteCall( "Liquid", "_LTKTriggerEvent(\""+driver+"\");" );
  121. }
  122.  
  123. function LTKDoHelp()
  124. {
  125.     return top._RouteCall( "Liquid", "_LTKTriggerEvent('CommandDispatcher,Active,20140');" );
  126. }
  127.  
  128. function LTKConnectToWorkflow(wkf)
  129. {
  130.     return top._RouteCall( "Liquid", "_LTKConnectToWorkflow('"+wkf+"');" );
  131. }
  132.  
  133. function LTKDisconnectFromWorkflow(wkf)
  134. {
  135.     return top._RouteCall( "Liquid", "_LTKDisconnectFromWorkflow('"+wkf+"');" );
  136. }
  137.  
  138. function LTKGetContext( Ctx )
  139. {
  140.     return top._RouteCall( "Liquid", "_LTKGetContext("+Ctx+");" );
  141. }
  142.  
  143. function isMapi()
  144. {
  145.     return top._RouteCall( "Liquid", "_isMapi();" );
  146. }
  147.  
  148. function isPrinters()
  149. {
  150.     return top._RouteCall( "Liquid", "_isPrinters();" );
  151. }
  152.  
  153. function LTKGetKeyValue( KeyName, ValueName, Default )
  154. {
  155.     return top._RouteCall( "Liquid", "_LTKGetKeyValue('"+KeyName+"','"+ValueName+"','"+Default+"');" );
  156. }
  157.  
  158. function LTKGetIntKeyValue( KeyName, ValueName, Default )
  159. {
  160.     return top._RouteCall( "Liquid", "_LTKGetIntKeyValue('"+KeyName+"','"+ValueName+"','"+Default+"');" );
  161. }
  162.  
  163. function LTKSetKeyValue( KeyName, ValueName, Value )
  164. {
  165.     return top._RouteCall( "Liquid", "_LTKSetKeyValue('"+KeyName+"','"+ValueName+"','"+Value+"');" );
  166. }
  167.  
  168. function LTKSetIntKeyValue( KeyName, ValueName, Value )
  169. {
  170.     return top._RouteCall( "Liquid", "_LTKSetIntKeyValue('"+KeyName+"','"+ValueName+"','"+Value+"');" );
  171. }
  172.  
  173. function LTKGetWorkflowValue( WkfName, WkfStep)
  174. {
  175.     return top._RouteCall( "Liquid", "_LTKGetWorkflowValue('"+WkfName+"','"+WkfStep+"');" );
  176. }
  177.  
  178. function LTKSetWorkflowValue( WkfName, WkfStep, Value)
  179. {
  180.     return top._RouteCall( "Liquid", "_LTKSetWorkflowValue('"+WkfName+"','"+WkfStep+"','"+Value+"');" );
  181. }
  182.  
  183. function LTKGetWorkflowMinValue( WkfName, WkfStep)
  184. {
  185.     return top._RouteCall( "Liquid", "_LTKGetWorkflowMinValue('"+WkfName+"','"+WkfStep+"');" );
  186. }
  187.  
  188. function LTKSetWorkflowMaxValue( WkfName, WkfStep, Value)
  189. {
  190.     return top._RouteCall( "Liquid", "_LTKSetWorkflowMaxValue('"+WkfName+"','"+WkfStep+"','"+Value+"');" );
  191. }
  192.  
  193. function LTKGetWorkflowStringArrLength( WkfName, WkfStep)
  194. {
  195.     return top._RouteCall( "Liquid", "_LTKGetWorkflowStringArrLength('"+WkfName+"','"+WkfStep+"');" );
  196. }
  197.  
  198. function LTKGetWorkflowStringArrItem( WkfName, WkfStep, Index )
  199. {
  200.     return top._RouteCall( "Liquid", "_LTKGetWorkflowStringArrIteme('"+WkfName+"','"+WkfStep+"','"+Index+"');" );
  201. }
  202.  
  203. function LTKSetWorkflowStringArrItem( WkfName, WkfStep, Index, Item )
  204. {
  205.     return top._RouteCall( "Liquid", "_LTKGetWorkflowStringArrIteme('"+WkfName+"','"+WkfStep+"','"+Index+"','"+Item+"');" );
  206. }
  207.  
  208. ////////////////////////////////////////////////////////////////
  209. //
  210. //    String manipulation (All slashes are expected forward!)
  211. //
  212.  
  213. // Resolve a relative path to a base path
  214. function ResolvePath( sBasePath, sRelativePath )
  215. {
  216.     var sNewBasePath;
  217.     var sNewEndPath;
  218.  
  219.     var nLevelBack = 1;        // Fix for last backslash
  220.     var nCurrIdx = 0;
  221.  
  222.     var nTemp;
  223.  
  224.     // Start by removing the filename from sBasePath if present
  225.     sNewBasePath = sBasePath.substring(0, sBasePath.lastIndexOf("/")+1 );
  226.  
  227.     // Count the number of levels we must go back
  228.     while(1)
  229.     {
  230.         nTemp = sRelativePath.indexOf( "../", nCurrIdx );
  231.  
  232.         if( nTemp >= 0 )
  233.         {
  234.             nCurrIdx = nTemp + 3;    // "../".length;
  235.             nLevelBack += 1;
  236.         }
  237.         else
  238.         {
  239.             break;
  240.         }
  241.     }
  242.  
  243.     sNewEndPath = sRelativePath.substring( nCurrIdx, sRelativePath.length );
  244.  
  245.     // Go back
  246.     while( nLevelBack > 0 )
  247.     {
  248.         nTemp = sBasePath.lastIndexOf("/", sNewBasePath.length-1);
  249.         sNewBasePath = sNewBasePath.substring( 0, nTemp );
  250.         nLevelBack -= 1;
  251.     }
  252.  
  253.     // Return the value
  254.     return sNewBasePath + "/" + sNewEndPath;
  255. }
  256.             
  257.  
  258. ////////////////////////////////////////////////////////////////
  259. //
  260. //    Miscelaneous stuff
  261. //
  262.  
  263. function SmartJump( fTarget, sNewTarget )
  264. {
  265.     return top._SmartJump(fTarget, sNewTarget );
  266. }
  267.  
  268. // Absolute path version
  269. function SmartJumpAbs( fTarget, sNewTarget )
  270. {
  271.     return top._SmartJumpAbs( fTarget, sNewTarget );
  272. }
  273.  
  274.  
  275. ////////////////////////////////////////////////////////////////
  276. //
  277. //    Event Sink and dispatch
  278. //
  279.  
  280. // Hook to event dispatch chain
  281. function AdviseSink( window )
  282. {
  283.     return top._AdviseSink( window );
  284. }
  285.  
  286. // Remove from event dispatch chain
  287. function UnadviseSink( window )
  288. {
  289.     return top._UnadviseSink( window );
  290. }
  291.  
  292. // Notify all
  293. function NotifySink( id, wparam, lparam )
  294. {
  295.     return top._NotifySink( id, wparam, lparam );
  296. }
  297.  
  298. // Note: frame calling AdviseSink MUST implement a function:
  299. //
  300. // function EventSinkImpl( id, wparam, lparam );
  301. // 
  302. // If the function returns 0, event has been handled and all
  303. // further processing is canceled. If function return 1,
  304. // NotifySink will call next registered handler (in reverse order).
  305.  
  306. function LTKSetContextHelp(nHelpID)
  307. {
  308.     return top._RouteCall( "Liquid", "_LTKTriggerEvent('CommandDispatcher,Broadcast,20147,"+nHelpID+"');" );
  309. }
  310.